<template>
    <div>
        <ui-title>评论</ui-title>
        <div class="p20 bg-light-white">
            <router-link 
            v-for="item in datalist"
            :key="item.id"
            :to="{name:'文章详情',query:{id:item.post_id}}" tag="div"
            class="flex cursor-pointer mb15">
                <div>
                    <ui-img :url="item.avatar" size="40px" class="ui-circle bg-grey"></ui-img>
                </div>
                <div class="flex-1 pl15 ui-border-bottom pb15">
                    <div class="comment-username mb10 f14">
                        <div>{{item.user_nicename}}</div>
                        <div class="f10 f-color-grey">{{item.createtime_show}}</div>
                    </div>
                    <div class="clamp-3 pr15 f10">{{item.content}}</div>
                </div>
            </router-link>
        </div>
    </div>
</template>
<script>
    export default {
        data(){
            return {
                datalist:[]
            }
        },
        created(){
            this.$http.get('index.php?g=home&m=Comments&a=comments_list', {
                params:{
                    post_table: 'posts',
                    page_size: 5
                }
            })
            .then(({data})=>{
                // console.log('评论', data)
                if (data.code===1) {
                    this.datalist=data.data
                }
            })
        },
    }
</script>